<?php
require_once $_SERVER ['DOCUMENT_ROOT'] . "/bib/class/php/mysql_class.php";
$mysql_bib = new mysql_class ( 'localhost', 'root', '', 'regi' );
// $mysql_bib = new mysql_class('vksm.net.mysql', 'vksm_net', 'egDYxATy','vksm_net');

if (isset ( $_POST ['M_id_video'] ) && isset ( $_POST ['M_url'] ) && isset ( $_POST ['M_id_user'] ) && isset ( $_POST ['M_onecomment'] ) && isset ( $_POST ['id_user'] )) // Si on reçoit des données via une méthode POST
{
	if (! empty ( $_POST ['M_id_video'] ) && ! empty ( $_POST ['M_url'] ) && ! empty ( $_POST ['M_id_user'] ) && ! empty ( $_POST ['M_onecomment'] ) && ! empty ( $_POST ['M_id_user'] )) 	// Et si leur valeur n'est ni NULL, ni vide
	{
		$insert = array (
				"id_video" => $_POST ['M_id_video'],
				"url" => $_POST ['M_url'],
				"id_user" => $_POST ['M_id_user'],
				"comment" => $_POST ['M_onecomment'],
				"mydate" => Date ( "d/m/Y:H:i:s" ) 
		);
		$id = $mysql_bib->mysql_insert ( "videocomment", $insert );
	}
}

$id_video = $_POST ['M_id_video'];

$data = $C_sql->query ( "SELECT comment, mydate, pseudo FROM videocomment v, user u WHERE u.id = v.id_user AND id_video = '$id_video'" );

foreach ( $data as $request ) {
	echo '<p>' . $request ['mydate'] . '&nbsp;&nbsp;&nbsp;<strong>' . $request ['pseudo'] . ' : ' . $request ['comment'] . '</p>';
}

?>

